package j05zuoye.hit;

public class ContainsRectPoint {
    public static void main(String[] args) {
        Rectangle r = new Rectangle(
                new Point(0,4),
                4,
                5
        );
//        Point p = new Point(6,4);
        Point p = new Point(2,3);

        System.out.println(containsPoint(r,p));
    }

    public static boolean containsPoint(Rectangle r,Point p) {
        return p.getX()>r.getStartPoint().getX()
                && p.getX()<r.getStartPoint().getX()+r.getWidth()
                && p.getY()>r.getStartPoint().getY()-r.getHeight()
                && p.getY()<r.getStartPoint().getY();
    }
}

